<Html>
<Head>
<Title> Super Awsome Webpage </Title>
<Script type = "text/javascript">
var length = prompt("Enter a length for the password you are about to create. (Your password has to be between 5 and 382 characters long.)");

while(isNaN(length)){
	length = prompt("Please enter a number between 5 and 382");
}
length = parseInt(length);
while(length < 5 || length > 382){
length = prompt("Please enter a number between 5 and 382");
while(isNaN(length)){
	length = prompt("Please enter a number between  5 and 382");
}
}
var numbers_flag = confirm("Do you want numbers to be included in your password? (ok is 'yes' and cancel is 'no')");
var lowerCase_flag = confirm("Do you want lower case letters to be included in your password? (ok is 'yes' and cancel is 'no')");
var upperCase_flag = confirm("Do you want upper case letters to be included in your password? (ok is 'yes' and cancel is 'no')");
var symbols_flag = confirm("Do you want symbols to be included in your password? (ok is 'yes' and cancel is 'no')");
while (numbers_flag == false && lowerCase_flag == false && upperCase_flag == false && symbols_flag == false ) {
alert("Good job! Since you have not chose anything to create your password with you have to start over!");
	

}
var numbers = "0123456789";
var lowerCase = "abcdefghijklmnopqrstuvwxyz";
var upperCase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
var symbols = "!@#$%^&*()_+|\]}[{;:'/?.>,<";
var possibleChars = "";
if (numbers_flag == true) {
	possibleChars = possibleChars + numbers;
}
if (lowerCase_flag == true) {
	possibleChars = possibleChars + lowerCase;
}
if (upperCase_flag == true) {
	possibleChars = possibleChars + upperCase;
	}
	if (symbols_flag == true) {
	possibleChars = possibleChars + symbols;
}
var y = possibleChars.length;
var password =[];
var i = 0;
while (i < length) {
password [i] = possibleChars.charAt(Math.floor(Math.random() * y)); 
i++;
}
password = password.join("");
alert("Your new password is: " + password);
</Script>
</Head>
<Body>
<center>
</Body>
</Html>
